<template>
    <h3>我是子组件</h3>

    <div>
      <input v-model="a" placeholder="请输入"/>
      <button @click="handleAdd" type="button">添加</button>
    </div>
</template>
<script setup>
    import { ref } from 'vue'
    const list = ref(['JavaScript', 'HTML', 'CSS'])
    const a= ref('1')
    // add 触发后的事件处理函数
    const handleAdd = () => {
        list.value.push(a.value)
        a.value = ''
    }
    defineExpose({ 
        list,
        childName: "这是子组件的属性",
        someMethod(){
            console.log("这是子组件的方法")
        }
    })
</script>